##### User configurable options #####

F77         = ifort
FLINKER     = libtool
OPTFLAGS    = -tpp7 -O3 -r8 -i4 -xW -w -dps -g
#

### End User configurable options ###

FFLAGS =  $(OPTFLAGS) -lhdf5 -lhdf5_fortran -L/usr/lib
FLIBS = /usr/lib/libH5PartF.la
EXECS = sphturb
BINDIR = bin
FILES = SPHturb01_Main.f \
	   SPHturb02_IO.f \
	   SPHturb021_IO_H5.f \
	   SPHturb03_STAT.f \
	   SPHturb10_Euler.f \
	   SPHturb101_EulerGhost.f \
	   SPHturb11_RK4.f \
	   SPHturb111_RK4Ghost.f \
	   SPHturb20_FLUID.f \
	   SPHturb21_Hash.f \
	   SPHturb22_Grad.f \
	   SPHturb221_GradGhost.f \
	   SPHturb23_Regroup.f \
	   SPHturb24_Interpolation.f \
	   SPHturb30_Kernel.f \
	   SPHturb31_Correction.f \
	   SPHturb40_Dual.f \
	   SPHturb90_Tool.f \
	   SPHturb91_String.f\
	   SPHturb92_Matrix.f\
	   Geo_ellipse.f90
OBJS = SPHturb01_Main.o \
	   SPHturb02_IO.o \
	   SPHturb021_IO_H5.o \
	   SPHturb03_STAT.o \
	   SPHturb10_Euler.o \
	   SPHturb101_EulerGhost.o \
	   SPHturb11_RK4.o \
	   SPHturb111_RK4Ghost.o \
	   SPHturb20_FLUID.o \
	   SPHturb21_Hash.o \
	   SPHturb22_Grad.o \
	   SPHturb221_GradGhost.o \
	   SPHturb23_Regroup.o \
	   SPHturb24_Interpolation.o \
	   SPHturb30_Kernel.o \
	   SPHturb31_Correction.o \
	   SPHturb40_Dual.o \
	   SPHturb90_Tool.o \
	   SPHturb91_String.o\
	   SPHturb92_Matrix.o\
	   Geo_ellipse.o
HEADS = common.fi param.fi

default: $(EXECS)

$(EXECS): $(OBJS) $(HEADS) 
	$(FLINKER) --tag=FC --mode=link $(F77) $(FFLAGS)  $(OBJS) $(FLIBS) -o $(EXECS)
	cp $(EXECS) $(BINDIR)

#SPHturb01_Main.o: $(HEADS) SPHturb01_Main.f 
#SPHturb02_IO.o: $(HEADS) SPHturb02_IO.f
#SPHturb021_IO_H5.o: $(HEADS) SPHturb021_IO_H5.f
#SPHturb03_STAT.o: $(HEADS) SPHturb03_STAT.f
#SPHturb10_Euler.o: $(HEADS) SPHturb10_Euler.f
#SPHturb20_FLUID.o: $(HEADS) SPHturb20_FLUID.f
#SPHturb21_Hash.o: $(HEADS) SPHturb21_Hash.f
#SPHturb22_Grad.o: $(HEADS) SPHturb22_Grad.f
#SPHturb30_Kernel.o: $(HEADS) SPHturb30_Kernel.f
#SPHturb90_Tool.o: $(HEADS) SPHturb90_Tool.f
#SPHturb91_String.o: $(HEADS) SPHturb91_String.f

clean:
	/bin/rm -f *.o PI* core $(EXECS)

#.f.o: $(HEADS)
#	$(F77) $(FFLAGS) -c $*.f
#
$(OBJS): $(HEADS) $(FILES)
	$(F77) $(FFLAGS) -c $(FILES)


